package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.userbean.Collect;
import com.cskaoyan.service.wx.CollectService;
import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.vo.wx.CollectAddOrDeleteVo;
import com.cskaoyan.vo.wx.CollectList_WxVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wx/collect")
public class WxCollectController {

    @Autowired
    CollectService collectService;

    @RequestMapping("addordelete")
    public BaseRespVo addOrDelete(@RequestBody Collect collect) {
        CollectAddOrDeleteVo addOrDelete = collectService.addOrDelete(collect);
        return BaseRespVo.ok(addOrDelete);
    }

    @RequestMapping("list")
    public BaseRespVo list(int type,Integer page,Integer size){     //这涉及后面关于Integer不能装换为byte的问题，所以直接用int来接收,但是传入的type如果为null，则会报异常
        CollectList_WxVo collectListVo = collectService.list(type,page,size);
        return BaseRespVo.ok(collectListVo);

    }

}
